/**
*      author: Y_Yao
*      created: 2024-11-16 00:25:19
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
int a[N],b[N];
int n;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    unordered_map<int,int> hash;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
    }

    for(int i = 1;i <= n;i++)
    {
        if(hash.count(a[i]))
        {
            b[i] = hash[a[i]];
            hash[a[i]] = i;
        }
        else
        {
            b[i] = -1;
            hash[a[i]] = i;
        }
    }

    for(int i = 1;i <= n;i++)
    {
        cout << b[i] << " ";
    }

    return 0;
}